//
//  ViewController.m
//  代理传值~dome
//
//  Created by 石虎 on 2017/8/9.
//  Copyright © 2017年 shihu. All rights reserved.
//

#import "ViewController.h"
#import "SHTwoViewController.h"//把本类的值用代理传值到ViewController

@interface ViewController ()<SHTwoViewControllerDelegate>

//代理传值显示数据文本框
@property (weak, nonatomic) IBOutlet UITextField *delegateField;
//点击到实现代理功能界面
- (IBAction)delegateBtnClick:(UIButton *)sender;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"代理传值";
}
#pragma mark - 点击到实现代理功能界面
- (IBAction)delegateBtnClick:(UIButton *)sender {
    
    //把本类的值用代理传值到ViewController
    SHTwoViewController *share =[[SHTwoViewController alloc] init];
    self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"返回" style:UIBarButtonItemStylePlain target:nil action:nil];
    share.delegate = self;
    [self presentViewController:share animated:YES completion:nil];
}

#pragma mark - 调用发送方的传递方法，将参数 value 赋值给接收的位置
-(void)changeValue:(NSString *)value {
    
    self.delegateField.text =value;
}
@end
